//
// Created by Administrator on 2020/8/19.
//
#include "Stock.h"
#include <iostream>

int main() {

    Stock stock;

    stock.showStock();
    stock.incStock(100);
    stock.showStock();
    stock.descStock(99);
    stock.showStock();

    std::cout << "******************************************" << std::endl;
    // 给类赋值的时候，会创建一个临时的Stock实例，然后把临时实例的字段赋值给stock变量对应的实例，然后析构临时Stock实例
    stock = Stock(77);
    std::cout << "******************************************" << std::endl;
    stock.incStock(999);
    stock.showStock();
    std::cout << "******************************************" << std::endl;

    Stock stock2{789};
    auto maxVal = stock2.maxVal(stock);
    std::cout << "maxVal******************************************" << std::endl;
    maxVal.showStock();
    std::cout << "maxVal******************************************" << std::endl;
    return 0;
}